#ifndef CALCULATE_LOWERCOMPUTER_DATA_H
#define CALCULATE_LOWERCOMPUTER_DATA_H

#include <QObject>
#include <QTimer>

/**
 * 1，总风压力降的多一些
 * 2，紧急制动按下，就会自动弹起
 * 3，YZG-1：制动缸压力360；YZ-1：制动压力：420
 * 4，仪表盘刻度100为一大刻度；
 *
 *
1,大闸缓解、制动，小闸制动，紧急制动、辅助制动，会使用总风缸

*/

class CalculateLowerComputerData : public QObject
{
    Q_OBJECT
public:
   CalculateLowerComputerData();
   // explicit CalculateLowerComputerData(QObject *parent = nullptr);

private:
   QTimer *m_timer;
   //刷新时间（毫秒）
   int m_refreshTime = 20;
   double m_timeUnit = 1000.0/m_refreshTime;

private:
   //总风杠
    double m_totalWindCylinderPressure = 0.0;
    //列车管
    double m_trainPipePressure= 0.0;
    //均风缸
    double m_equalizeCylinderPressure = 0.0;
    //制动缸
    double m_brakeCylinderPressure = 0.0;

    double m_totalWindCylinderPressureDifference = 2;

    //制动缸压力的最大值
    double m_maxBrakeCylinderPressure = 360.0;

    //是否给总分杠压力冲风，低于660时，为true
    bool m_isImpulsetotalWindCylinderPressure = true;

    //加速度
    //启动车后
    //总风缸压力
    double m_totalWindCylinderPressureAcceleration_1 = 720.0/(160.0*m_timeUnit);

    //总风杠减少压力值

    double m_totalWindCylinderPressureDecreasevalue = 0;

    ////大闸
    ///制动位
    //列车管（降低）
    double m_trainPipePressureAcceleration_2 = 500.0/(12.0*m_timeUnit);
    //均衡风缸（降低）
    double m_equalizeCylinderPressureAcceleration_2 = 500.0/(11.5*m_timeUnit);

    ///缓解位
    //列车管（降低）
    double m_trainPipePressureAcceleration_10 = 500.0/(4.0*m_timeUnit);
    //均衡风缸（降低）
    //0-250kPa
    double m_equalizeCylinderPressureAcceleration_10 = 500.0/(1.2*m_timeUnit);
    //250-500
    double m_equalizeCylinderPressureAcceleration_11 = 500.0/(6.6*m_timeUnit);

    ///大闸制动
    //制动缸压力（处于制动位）
    double m_brakeCylinderPressureAcceleration_3 = 360.0/(2.0*m_timeUnit);

    ///大闸缓解
    //大闸：制动缸（降低）；
    double m_brakeCylinderPressureAcceleration_2 = 360.0/(4.0*m_timeUnit);


    //大闸下压位【制动缸减压力】;
    //小闸制动，大闸只有下压，才可以减少制动，大闸缓解不可以
     double m_brakeCylinderPressureAcceleration_4 = 360.0/(1.25*m_timeUnit);

     //大、小闸
    ///保压位
    double m_trainPipePressureAcceleration_9 = 360.0/(8800.0*m_timeUnit);
    double m_brakeCylinderPressureAcceleration_9 = 360.0/(8800.0*m_timeUnit);

    ////小闸
    ///下压位————制动缸（减少）
    double m_brakeCylinderPressureAcceleration_5 = 360.0/(1.9*m_timeUnit);
    //小闸：制动缸（上升）
    double m_brakeCylinderPressureAcceleration_10 = 360.0/(1.7*m_timeUnit);


    //紧急制动
    //列车管（降压）
    double m_trainPipePressureAcceleration_6 = 500.0/(1.5*m_timeUnit);
    //制动缸（升压）
    double m_brakeCylinderPressureAcceleration_6 = 420.0/(1.02*m_timeUnit);
    //总风缸（减压）
    double m_brakeCylinderPressureAcceleration_8 = 360.0/(45*m_timeUnit);

    //辅助制动（制动缸压力下降）
    double m_brakeCylinderPressureAcceleration_7 = 360.0/(1.16*m_timeUnit);

public slots:
    //开始计算
    void stopCalculateWork();
    //关闭计算
    void startCalculateWork();

signals:
    void refreshShow();
};

#endif // CALCULATE_LOWERCOMPUTER_DATA_H
